package com.jzo2o.customer.controller.agency;


import com.jzo2o.customer.model.domain.BankAccount;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.service.IBankAccountService;
import com.jzo2o.mvc.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 银行账户 前端控制器
 * </p>
 *
 * @author itlxc
 * @since 2024-10-14
 */
@RestController("agencyBankAccountController")
@RequestMapping("/agency/bank-account")
@RequiredArgsConstructor
@Api(tags = "机构端 - 银行账户信息相关接口")
@Slf4j
public class BankAccountController {

    private final IBankAccountService bankAccountService;


    @PostMapping
    @ApiOperation("新增或更新银行账户信息")
    public Result saveOrUpdateAccount(@RequestBody BankAccountUpsertReqDTO dto) {
        log.info("新增或更新银行账户信息参数：{}", dto);
        bankAccountService.saveOrUpdateAccount(dto);
        return Result.ok();
    }

    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户银行账户信息")
    public BankAccount currentUserBankAccount() {
        log.info("获取当前用户银行账户信息");
        return bankAccountService.getCurrentUserBankAccount();
    }

}
